import re
import time
import datetime


def get_article_id(value):
    """
    提取数字
    """
    return re.findall(r'/(\d+)/', value)


def get_re_num(value):
    """
    提取数字
    """
    return re.findall(r'.*?(\d+).*', value)


def str_data_to_num(value):
    """
    格式时间成秒
    """
    value_tmp = value
    if value_tmp is None or len(value_tmp) <= 0:
        cur = datetime.datetime.now()
        value_tmp = '{y}-{m}-{d}'.format(y=cur.year, m=cur.month, d=cur.day)
    strp_time = time.strptime(value_tmp, '%Y-%m-%d')
    mk_time = int(time.mktime(strp_time))
    return mk_time


def get_cur_data():
    """
    当前时间毫秒
    """
    cur = datetime.datetime.now()
    value_tmp = '{y}-{m}-{d}'.format(y=cur.year, m=cur.month, d=cur.day)
    strp_time = time.strptime(value_tmp, '%Y-%m-%d')
    mk_time = int(time.mktime(strp_time))
    return mk_time


def get_nums(value=0):
    """
    返回数字
    """
    return int(value)


def get_html_str(value=''):
    list_str = re.findall(r'<[^>]+>', value)
    value_tmp = value
    for item in list_str:
        value_tmp = value_tmp.replace(item, '')
    return value_tmp
